import os
import asyncio
from send_chat_request.send_chat_request_review import fetch_all_review, FILE_NAME
from send_chat_request.send_chat_request import fetch_all
from read.AiCorrecte import AiCorrecte
from xlsx_utils.calculate_variance_and_deviation import calculate_variance_and_deviation
from read.QuestionBank import QuestionBank

# 获取当前文件所在目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建题库文件路径
question_bank_path = os.path.join(current_dir, "教材题库.xlsx")

print(f"question_bank_path: {question_bank_path}")
# 步骤一  ai生成模型解题
#  下面函数执行用于生成模型解题 => 生成xlsx表格中 assistant-slove.xlsx
# qb = QuestionBank(question_bank_path)
# querys = qb.display_questions()
# responses = asyncio.run(fetch_all(querys,))  # 运行异步函数


# 步骤二 ai生成模型批改
# 下面生成模型批改（从 assistant-slove.xlsx 文件读取题目）  => 生成xlsx表格中 assistant-review.xlsx
aiCorrect = AiCorrecte("assistant-slove.xlsx")
querys = aiCorrect.display_questions()

responses = asyncio.run(fetch_all_review(querys))  # 运行异步函数

# 调用函数
# calculate_variance_and_deviation(FILE_NAME)
